package com.wan.nettyproject;

/**
 * Created by itsxzx008 on 2016/5/4.
 */
public class SocketManager {
    private static SocketManager inst = new SocketManager();
    private SocketThread socketThread;
    public static SocketManager instance() {
        return inst;
    }

    public SocketManager() {

    }
    public void connectMsgServer() {
        //check again,may be unimportance
        if (socketThread != null) {
            socketThread = null;
        }

        socketThread = new SocketThread(UrlConfig.IP,UrlConfig.PORT,new MsgServerHandler());
        socketThread.start();
    }
    public void sendMessage(MessageEnty messageEnty){
        socketThread.sendRequest(messageEnty);
    }

    public void sendRequest(Object requset ){
        socketThread.sendRequest(requset);
    }
}
